package filter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author liuzesen
 * @CreateDate 16/3/25
 */
@RestController
public class Controller {
    @Autowired
    SensitiveWords sensitiveWords;

    @RequestMapping(value = "/check", method = RequestMethod.POST)
    public boolean check(HttpServletRequest req) {
        return sensitiveWords.check(req.getParameter("content"));
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public String update() {
        sensitiveWords.update();
        return "敏感词已更新";
    }
}
